﻿package Welsy4.Connect.events {

	import Welsy4.Connect.vo.IReturnValue;
	//import Welsy4.Connect.vo.ReturnValue;

	/*
	 * ResponseEvent è una classe di eventi che contiene IReturnValue implements
	 *
	 *
	 * */

	public class ResponseEvent extends ChainEvent implements IReturnValue {

		public static var ERROR : String = "ERROR";
		public static var NO_DATA_ERROR : String = "NO_DATA";

		public static var COMMON_INFO_EXECUTED : String = "COMMON_INFO_EXECUTED";

		public static var LOGGED_IN : String = "LOGGED_IN";
		public static var USER_LOGGED_IN : String = "USER_LOGGED_IN";
		public static var LOGGED_OUT : String = "LOGGED_OUT";
		public static var USER_EXISTS : String = "USER_EXISTS";

		public static var USER_CREATED : String = "USER_CREATED";
		public static var MEETING_CREATED : String = "MEETING_CREATED";
		public static var MEETING_UPDATED : String = "MEETING_UPDATED";
		public static var MEETING_DELETED : String = "MEETING_DELETED";
		public static var MEETING_FOUND : String = "MEETING_FOUND";
		public static var PARTICIPANTS_ADDED : String = "PARTICIPANTS_ADDED";
		public static var PARTICIPANTS_REMOVED : String = "PARTICIPANTS_REMOVED";
		public static var PARTICIPANT_REMOVED : String = "PARTICIPANT_REMOVED";
		public static var USER_ALLOWED_TO_MEETING : String = "USER_ALLOWED_TO_MEETING";

		/* valori di ResultCode */
		public static var CONNECTION : int = -1;
		public static var INVALID : int = 0;
		public static var NO_DATA : int = 1;
		public static var DENIED : int = 2;
		public static var GENERIC : int = 3;

		/* Welsy4.Connect.commands error 100 FAULT*/
		public static var COMMON_INFO_COMMAND_FAULT : int = 101;
		public static var LOGIN_COMMAND_FAULT : int = 102;
		public static var LOGOUT_COMMAND_FAULT : int = 103;
		public static var SECURE_LOGIN_COMMAND_FAULT : int = 104;
		public static var CREATE_MEETING_COMMAND_FAULT : int = 105;
		public static var SCO_SHORTCUT_COMMAND_FAULT : int = 106;

		/* Welsy4.Connect.commands error 400 BAD RESULT*/
		public static var LOGIN_REQUIRED : int = 401;

		public static var OK : int = 202;

		/* Error Description */
		public static var SCO_NOT_FOUND : String = "Il tipo di SCO richiesto non è stato trovato";
		public static var MEETING_NOT_FOUND : String = "Il meeting non è stato trovato";
		public static var USER_NOT_FOUND : String = "Utente non trovato";
		public static var GENERIC_COMMAND_FAULT : String = "Errore nella connessione. Riprovare più tardi";
		public static var AUTHENTICATION_REQUIRED : String = "Richiesta autenticazione";

		/* vars */
		public var status : Boolean;
		public var resultCode : int;
		public var ResultObject : Object;
		public var ErrorDescription : String;

		public function ResponseEvent(type : String, Status : Boolean = true, ResultCode : int = 202, ResultObject : Object = null, ErrorDescription : String = null) {
			super(type);
			this.status = Status;
			this.resultCode = ResultCode;
			this.ResultObject = ResultObject;
			this.ErrorDescription = ErrorDescription;
		}

		public function get Status() : Boolean {
			return this.status;
		}

		public function get ResultCode() : int {
			return this.resultCode;
		}

	/* 	public function get ErrorDescription() : String {
			switch (this.ResultCode) {
				case LOGIN_REQUIRED : 
					return AUTHENTICATION_REQUIRED;
			
			}
		} */


	}

}